<?php
namespace Clover\Controller;

use Think\Controller;

class RoleController extends BaseController
{
    public function __construct()
    {
        parent::__construct();
        session('menu', "admin");
    }

    public function index()
    {
        $login_status = D("Clover/Admin")->get_login_status();
        if (empty($login_status)) {
            $this->redirect('/Clover/login');
        }
        //D("Admin/Role")->get_role_list();
        $this->display("Index:user");
    }

    public function set_account()
    {

        $username = I("post.username", "");
        $password = I("post.password", "");
        $admin_id = session("admin_id");
        $data = array("username" => $username, "password" => md5($password));
        $res = D("Admin")->table("dsk_admin_user")->where("id=$admin_id")->save($data);
        if ($res) {
            session(null);
            $this->redirect("/Clover/login");
        }
    }


}